package com.yanqu.road.server.cmd.activity.zhenhuan;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ZhenHuanProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.zhenhuan.CrossZhenHuanMgr;
import com.yanqu.road.server.manager.activity.zhenhuan.CrossZhenHuanSecondActivity;
import com.yanqu.road.server.manager.activity.zhenhuan.CrossZhenHuanThirdProcessActivity;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_ZHENHUAN_THIRD_PROCESS_DEBUG_CODE, desc = "gm指令调试")
public class CrossZhenHuanThirdProcessDebugCmd extends CrossCommand {

    private int activityId;

    private String code;

    private String param;

    private long playerId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg reqMsg = ZhenHuanProto.CrossZhenHuanThirdProcessDebugReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        code = reqMsg.getCode();
        param = reqMsg.getParam();
        playerId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossZhenHuanThirdProcessActivity activity = CrossZhenHuanMgr.getThirdProcessActivity(activityId);
        if (activity != null) {
            activity.debugByCmd(playerId, code, param);
        }

        CrossZhenHuanSecondActivity secondActivity = CrossZhenHuanMgr.getSecondActivity(activityId);
        if (secondActivity != null) {
            secondActivity.debugByCmd(playerId, code, param);
        }

    }

    @Override
    public void sendData() {

    }
}
